import requests
from bs4 import BeautifulSoup
r = requests.get('https://sukebei.nyaa.se/?cats=8_30')
MainPages = BeautifulSoup(r.text, 'lxml')
SubLinkList = []
for i in MainPages.find_all('td', 'tlistname'):
    SubLinkList.append('https:'+i.a['href'])
Downloadlink = []
for i in SubLinkList:
    r = requests.get(i)
    SubPage = BeautifulSoup(r.text, 'lxml')
    SubLinkDownloadLink = SubPage.find_all('div', 'viewdownloadtxtbutton')
    print('https:'+SubLinkDownloadLink[0].a['href'])
    Downloadlink.append('https:'+SubLinkDownloadLink[0].a['href']+'\n')
f = open('download.txt', 'w')
f.writelines(Downloadlink)
